package com.itheima.jdbctemplate;

import com.itheima.dao.AdminDao;
import com.itheima.domain.Admin;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Dao 实现JdbcTemplate
 */
public class JdbcTemplate3 {

    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
        AdminDao adminDao = ac.getBean("AdminDao", AdminDao.class);
        Admin byId = adminDao.findById(4);
        System.out.println(byId);
        Admin username = adminDao.findByUsername("周杰伦");
        System.out.println(username);
        username.setUsername("周杰伦1");
        System.out.println(adminDao.updateAdmin(username));
    }
}
